package com.demo.forum.dao;

import com.demo.forum.model.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ArticleMapper {
    int insert(Article row);

    int insertSelective(Article row);

    Article selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Article row);

    int updateByPrimaryKeyWithBLOBs(Article row);

    int updateByPrimaryKey(Article row);

    List<Article> selectAll();
    List<Article> selectAllByBordId(@Param("boardId") Long boardId);

    /**
     * 根据文章 id 获取文章信息
     * @param id
     * @return
     */
    Article selectDetailById(@Param("id") Long id);


    /**
     * 根据 userId 获得文章,板块信息
     * @param userId
     * @return
     */
    List<Article> selectByUserId(@Param("userId") Long userId);


}